package objbo.xmlparser.model.bean;

import java.util.Iterator;
import java.util.List;
import java.util.Vector;


import org.dom4j.Attribute;
import org.dom4j.Node;
import org.dom4j.tree.DefaultAttribute;

public class ElementBean
{
	String Name = "";
	List attrebutes = new Vector<Attribute>();
	List<String> subElementNames = new Vector<String>();
	String content = ""; 
	String path = null;
	int index = 0;
	
	public String getName()
	{
		return Name;
	}
	public void setName(String name)
	{
		Name = name;
	}
	public List getAttrebutes()
	{
		return attrebutes;
	}
	public List<Attribute> getAttrebute(String name)
	{
		List<Attribute> vector = new Vector<Attribute>();
		Iterator<Attribute> iterator = attrebutes.iterator();
		
		Attribute tmpAttribute = null;
		
		while(iterator.hasNext())
		{
			tmpAttribute = iterator.next();
			
			if(tmpAttribute.getName().equals(name))
			{
				vector.add(tmpAttribute);
			}
		}

		return vector;
	}
	public void setAttrebutes(List attrebutes)
	{
		this.attrebutes = attrebutes;
	}
	public void setAttrebute(Attribute attribute)
	{
		this.attrebutes.add(attribute);
	}
	public void setAttrebute(String name, Object data)
	{
		Attribute attribute = new DefaultAttribute(name, data.toString());
				
		this.attrebutes.add(attribute);
	}
	public void setAttrebute(String name, String data)
	{
		Attribute attribute = new DefaultAttribute(name, data);
				
		this.attrebutes.add((Node)attribute);
	}
	public List<String> getSubElementNames()
	{
		return subElementNames;
	}
	public String getSubElementName(int index)
	{
		return subElementNames.get(index);
	}
	public void setSubElementNames(List<String> subElementNames)
	{
		this.subElementNames = subElementNames;
	}
	public void setSubElementName(String subElementNames)
	{
		this.subElementNames.add(subElementNames);
	}
	public String getContent()
	{
		return content;
	}
	public void setContent(String content)
	{
		this.content = content;
	}
	public String getPath()
	{
		return path;
	}
	public void setPath(String path)
	{
		this.path = path;
	}
	public int getIndex()
	{
		return index;
	}
	public void setIndex(int index)
	{
		this.index = index;
	}
	
	
	

}
